<html>
<head><meta charset="utf-8"><title>question about perf · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html">question about perf</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="220384416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220384416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220384416">(Dec 18 2020 at 15:23)</a>:</h4>
<p>Good morning/afternoon/evening.</p>
<p>Something i was wondering, i saw on the rust 2020 survey results that compiler perf will be a big focus. However, has rustc not gotten to the point that it being slow is due to the sheer amount of stuff it has to do? What are some examples of big-ish improvements that have yet to be done? id love to understand more, thanks <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="220386469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220386469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220386469">(Dec 18 2020 at 15:39)</a>:</h4>
<ul>
<li>rustdoc and rustc have exponential behavior on blanket impls: <a href="https://github.com/rust-lang/rustc-perf/pull/807#issuecomment-746005967">https://github.com/rust-lang/rustc-perf/pull/807#issuecomment-746005967</a>, <a href="https://github.com/rust-lang/rust/issues/79103">https://github.com/rust-lang/rust/issues/79103</a></li>
<li>rustc recompiles generic functions each time they're instantiated: <a href="https://github.com/rust-lang/rust/issues/77960">https://github.com/rust-lang/rust/issues/77960</a> (see also <a href="https://github.com/rust-lang/rust/pull/75185">https://github.com/rust-lang/rust/pull/75185</a> and work around that)</li>
<li>deriving traits is slower than implementing them yourself: <a href="https://github.com/rust-lang/rust/issues/80118">https://github.com/rust-lang/rust/issues/80118</a></li>
<li>the entire compiler is single-threaded: <a href="https://github.com/rust-lang/rust/pull/79706">https://github.com/rust-lang/rust/pull/79706</a></li>
</ul>



<a name="220386493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220386493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220386493">(Dec 18 2020 at 15:39)</a>:</h4>
<p>there's a bunch more stuff if you look under <a href="https://github.com/rust-lang/rust/labels/I-compiletime">https://github.com/rust-lang/rust/labels/I-compiletime</a></p>



<a name="220386689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220386689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220386689">(Dec 18 2020 at 15:40)</a>:</h4>
<p>see <a class="stream" data-stream-id="247081" href="/#narrow/stream/247081-t-compiler.2Fperformance">#t-compiler/performance</a> if you want to learn more</p>



<a name="220386706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220386706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220386706">(Dec 18 2020 at 15:40)</a>:</h4>
<ul>
<li>coherence checks are <code>O(n²)</code> and can dominate compile time for large generated code bases</li>
</ul>



<a name="220387787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220387787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220387787">(Dec 18 2020 at 15:48)</a>:</h4>
<p>oh and rustdoc does basically all computation twice: <a href="https://github.com/rust-lang/rust/issues/76382">https://github.com/rust-lang/rust/issues/76382</a></p>



<a name="220388574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220388574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220388574">(Dec 18 2020 at 15:54)</a>:</h4>
<p>Interesting, what are coherence checks exactly? do you have any resources on what they are?<br>
I have a decently large (75kloc+) codebase and its about 1:44m to 2m to compile from clean, but in some of my other projects its a lot slower despite having less code, could that be a part of it?</p>



<a name="220388724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220388724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220388724">(Dec 18 2020 at 15:55)</a>:</h4>
<p><span class="user-mention" data-user-id="276242">@Riccardo D'Ambrosio</span> the best way to tell why your code is slow is <code>-Z self-profile</code></p>



<a name="220388750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220388750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220388750">(Dec 18 2020 at 15:55)</a>:</h4>
<p>or if you don't want to mess with <code>summarize</code>, <code>-Z time-passes</code></p>



<a name="220388817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220388817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220388817">(Dec 18 2020 at 15:56)</a>:</h4>
<p>impossible to tell without measuring, you can try running with <code>-Zself-profile</code> to get more insight (<a href="https://github.com/rust-lang/measureme/blob/master/summarize/Readme.md">https://github.com/rust-lang/measureme/blob/master/summarize/Readme.md</a>)</p>



<a name="220388823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220388823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220388823">(Dec 18 2020 at 15:56)</a>:</h4>
<p>coherence checks are 'do these impls overlap'</p>



<a name="220388832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220388832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220388832">(Dec 18 2020 at 15:56)</a>:</h4>
<p>like orphan rule</p>



<a name="220388887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220388887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220388887">(Dec 18 2020 at 15:56)</a>:</h4>
<p>Oh i see, how come they are <code>O(n^2)</code>?</p>



<a name="220388915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220388915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220388915">(Dec 18 2020 at 15:56)</a>:</h4>
<p>specifically the overlap check is what's <code>O(n²)</code>, not checking for orphan rule violations</p>



<a name="220388966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220388966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220388966">(Dec 18 2020 at 15:57)</a>:</h4>
<p>because the easiest way to check for overlap between <code>N</code> elements is to take each pair and see if they overlap</p>



<a name="220388991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220388991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220388991">(Dec 18 2020 at 15:57)</a>:</h4>
<p>Oh makes sense</p>



<a name="220389021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389021">(Dec 18 2020 at 15:57)</a>:</h4>
<p>assuming each overlap check is constant-time, this results in quadratic runtime</p>



<a name="220389065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389065">(Dec 18 2020 at 15:57)</a>:</h4>
<p>Is it really possible to do that faster than <code>O(n²)</code> however? isnt it inherently <code>O(n²)</code>?</p>



<a name="220389133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389133">(Dec 18 2020 at 15:58)</a>:</h4>
<p>That's the question :)</p>



<a name="220389175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389175">(Dec 18 2020 at 15:58)</a>:</h4>
<p>Also where in rustc is this done? id like to take a look</p>



<a name="220389222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389222">(Dec 18 2020 at 15:58)</a>:</h4>
<p>I think we've actually fixed the worst cases of this recently, so maybe it doesn't cause practical issues anymore</p>



<a name="220389343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389343">(Dec 18 2020 at 15:59)</a>:</h4>
<p>also, where would you use parallel compilation in rustc? compilation is highly sequential as far as i know</p>



<a name="220389447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389447">(Dec 18 2020 at 16:00)</a>:</h4>
<p>A lot of work was put into parallelizing the query engine, and it does work in practice</p>



<a name="220389527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389527">(Dec 18 2020 at 16:00)</a>:</h4>
<p>As in looking up query results in parallel?</p>



<a name="220389794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389794">(Dec 18 2020 at 16:02)</a>:</h4>
<p>I recommend reading about the query system</p>



<a name="220389811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389811">(Dec 18 2020 at 16:02)</a>:</h4>
<p><code>specialization_graph.rs</code> is where trait impl overlap is checked</p>



<a name="220389824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389824">(Dec 18 2020 at 16:02)</a>:</h4>
<p><a href="https://rustc-dev-guide.rust-lang.org/query.html">https://rustc-dev-guide.rust-lang.org/query.html</a></p>



<a name="220389852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389852">(Dec 18 2020 at 16:02)</a>:</h4>
<p>Yeah i understand how queries in rustc work, i just dont understand where you would use parallelism in there</p>



<a name="220389919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389919">(Dec 18 2020 at 16:03)</a>:</h4>
<p>Often you want to run a query on all items in a crate</p>



<a name="220389939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389939">(Dec 18 2020 at 16:03)</a>:</h4>
<p><code>rg parallel_compiler compiler/</code> will give you some ideas</p>



<a name="220389957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389957">(Dec 18 2020 at 16:03)</a>:</h4>
<p>That's what this work will allow doing in parallel</p>



<a name="220389975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220389975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220389975">(Dec 18 2020 at 16:03)</a>:</h4>
<p>I see</p>



<a name="220390025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390025">(Dec 18 2020 at 16:03)</a>:</h4>
<p>For example, type checking, borrow checking, MIR building, etc.</p>



<a name="220390168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390168">(Dec 18 2020 at 16:04)</a>:</h4>
<p>But don't all of those (except maybe mir building) require sequential processing of all the data? Ive never heard of a parallelized type checker</p>



<a name="220390246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390246">(Dec 18 2020 at 16:05)</a>:</h4>
<p>not really? because queries are on-demand they don't really care about the order things are run</p>



<a name="220390253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390253">(Dec 18 2020 at 16:05)</a>:</h4>
<p>imagine the way <code>make</code> works</p>



<a name="220390293"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390293" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390293">(Dec 18 2020 at 16:05)</a>:</h4>
<p>you have order-based dependencies, but many things can be run in parallel if they're not strictly related</p>



<a name="220390308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390308">(Dec 18 2020 at 16:05)</a>:</h4>
<p>Every function can be type-checked in parallel, but they might invoke the same query at some point (which the implemented system handles)</p>



<a name="220390441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390441">(Dec 18 2020 at 16:06)</a>:</h4>
<p>Yeah crates can be compiled in parallel if they dont depend on eachother, i meant in a single crate environment however</p>



<a name="220390442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390442">(Dec 18 2020 at 16:06)</a>:</h4>
<p>(by "in parallel" I mean independently of any other function, minus the common queries they depend on)</p>



<a name="220390476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390476">(Dec 18 2020 at 16:06)</a>:</h4>
<p><span class="user-mention silent" data-user-id="276242">Riccardo D'Ambrosio</span> <a href="#narrow/stream/131828-t-compiler/topic/question.20about.20perf/near/220390441">said</a>:</p>
<blockquote>
<p>Yeah crates can be compiled in parallel if they dont depend on eachother, i meant in a single crate environment however</p>
</blockquote>
<p>right I mean that too</p>



<a name="220390549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390549">(Dec 18 2020 at 16:06)</a>:</h4>
<p>queries get to decide for themselves what the unit of compilation is, like type checking the body of a function doesn't depend on typechecking other function bodies</p>



<a name="220390558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390558">(Dec 18 2020 at 16:07)</a>:</h4>
<p>(only function signatures)</p>



<a name="220390606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390606">(Dec 18 2020 at 16:07)</a>:</h4>
<p>Hmm i've never heard of that, since if you have something like </p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="n">bar</span><span class="p">()</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">bar</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">usize</span> <span class="p">{</span><span class="w"> </span><span class="mi">6</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>how do you decide if the return type is correct if you havent type checked bar yet?</p>



<a name="220390694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390694">(Dec 18 2020 at 16:08)</a>:</h4>
<p>you type check <code>fn bar() -&gt; usize</code> without type checking <code>6</code></p>



<a name="220390738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390738">(Dec 18 2020 at 16:08)</a>:</h4>
<p>(since usually the body takes much longer)</p>



<a name="220390810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390810">(Dec 18 2020 at 16:08)</a>:</h4>
<p>Yeah, item signatures are decoupled from item bodies</p>



<a name="220390830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390830">(Dec 18 2020 at 16:08)</a>:</h4>
<p>but wouldnt looking at the return type require more checks if you tell it <code>Vec&lt;str&gt;</code> for example, which is incorrect?</p>



<a name="220390874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390874">(Dec 18 2020 at 16:09)</a>:</h4>
<p>Or will that be checked in a "full" pass through bar?</p>



<a name="220390876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390876">(Dec 18 2020 at 16:09)</a>:</h4>
<p>Callers of <code>bar</code> only need to know its signature</p>



<a name="220390904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390904">(Dec 18 2020 at 16:09)</a>:</h4>
<p>Then when <code>bar</code>'s body is checked, the type mismatch will be detected</p>



<a name="220390950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390950">(Dec 18 2020 at 16:09)</a>:</h4>
<p>But <em>callers</em> of <code>bar</code> don't care about that, they just look at its signature</p>



<a name="220390953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220390953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220390953">(Dec 18 2020 at 16:09)</a>:</h4>
<p>I see, so you only need to look at the return type and dont have to care if its a "wrong" type?</p>



<a name="220391042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220391042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220391042">(Dec 18 2020 at 16:10)</a>:</h4>
<p>well you assume it's correct and that only the implementation can be wrong</p>



<a name="220391093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220391093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220391093">(Dec 18 2020 at 16:10)</a>:</h4>
<p>although this all gets tricky with <code>impl Trait</code>, I don't know how that works</p>



<a name="220391112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220391112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220391112">(Dec 18 2020 at 16:10)</a>:</h4>
<p>This feels difficult to get "right" as in do it without potentially missing issuing some errors and have it be accurate</p>



<a name="220391137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220391137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220391137">(Dec 18 2020 at 16:10)</a>:</h4>
<p>well that's why the query system is complicated <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="220391151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220391151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220391151">(Dec 18 2020 at 16:10)</a>:</h4>
<p>but it does work</p>



<a name="220391166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220391166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220391166">(Dec 18 2020 at 16:10)</a>:</h4>
<p>yeah ive seen the big query file <span aria-label="sweat" class="emoji emoji-1f613" role="img" title="sweat">:sweat:</span></p>



<a name="220391188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220391188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220391188">(Dec 18 2020 at 16:11)</a>:</h4>
<p>All of this complexity is in the query system, not the rest of the compiler</p>



<a name="220391401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220391401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220391401">(Dec 18 2020 at 16:11)</a>:</h4>
<p>interesting</p>



<a name="220391413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220391413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220391413">(Dec 18 2020 at 16:11)</a>:</h4>
<p><code>impl Trait</code> is indeed a form of global inference, so that "breaks" the parallel model (in that it introduces some sequential steps)</p>



<a name="220391567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220391567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220391567">(Dec 18 2020 at 16:12)</a>:</h4>
<p>Somewhat unrelated, what is the status of cranelift being used by default for debug builds or with a <code>-Z</code> flag?</p>



<a name="220391638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220391638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220391638">(Dec 18 2020 at 16:12)</a>:</h4>
<p>I don't think we currently get too much of a speedup, because a lot of things are still sequential</p>



<a name="220391665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220391665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220391665">(Dec 18 2020 at 16:12)</a>:</h4>
<p><span class="user-mention silent" data-user-id="276242">Riccardo D'Ambrosio</span> <a href="#narrow/stream/131828-t-compiler/topic/question.20about.20perf/near/220391567">said</a>:</p>
<blockquote>
<p>Somewhat unrelated, what is the status of cranelift being used by default for debug builds or with a <code>-Z</code> flag?</p>
</blockquote>
<p>Still requires custom rustc build AFAIK</p>



<a name="220391695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220391695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220391695">(Dec 18 2020 at 16:13)</a>:</h4>
<p>yeah, let me pull up the blog post</p>



<a name="220391714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220391714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220391714">(Dec 18 2020 at 16:13)</a>:</h4>
<p><a href="https://blog.rust-lang.org/inside-rust/2020/11/15/Using-rustc_codegen_cranelift.html">https://blog.rust-lang.org/inside-rust/2020/11/15/Using-rustc_codegen_cranelift.html</a></p>



<a name="220391952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220391952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220391952">(Dec 18 2020 at 16:15)</a>:</h4>
<p>Time to light my cpu on fire trying to compile rustc <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="220392470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220392470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220392470">(Dec 18 2020 at 16:18)</a>:</h4>
<p>For now building it from <a href="https://github.com/bjorn3/rustc_codegen_cranelift/">https://github.com/bjorn3/rustc_codegen_cranelift/</a> may be a better idea. That doesn't require building a whole compiler.</p>



<a name="220392669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220392669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220392669">(Dec 18 2020 at 16:20)</a>:</h4>
<p>I see, ill try that. My project uses std::arch x86 intrinsics in one spot, i remember simd being an issue for cg_clif, has that been fixed?</p>



<a name="220392755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220392755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220392755">(Dec 18 2020 at 16:20)</a>:</h4>
<p>Which intrinsics does it use? Simd support has got a bit better but there are still many intrinsics that are unimplemented.</p>



<a name="220392874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220392874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220392874">(Dec 18 2020 at 16:21)</a>:</h4>
<p>This is all of the code: <a href="https://github.com/rslint/rslint/blob/master/crates/rslint_core/src/groups/errors/no_irregular_whitespace.rs#L113">https://github.com/rslint/rslint/blob/master/crates/rslint_core/src/groups/errors/no_irregular_whitespace.rs#L113</a></p>
<p>It uses loadu, set1_epi8, cmpeq, and movemask</p>



<a name="220393682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220393682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220393682">(Dec 18 2020 at 16:27)</a>:</h4>
<p><code>_mm256_loadu_si256</code> uses <code>ptr::copy_nonoverlapping</code>. <code>_mm256_set1_epi8</code> directly constructs the simd value without intrinsic. <code>_mm256_cmpeq_epi8</code> uses the <code>simd_eq</code> platform intrinsic and <code>_mm_movemask_epi8</code> uses <code>pmovmskb</code>. All of them are implemented in cg_clif.</p>



<a name="220393748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220393748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220393748">(Dec 18 2020 at 16:27)</a>:</h4>
<p>Cool</p>



<a name="220393846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220393846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220393846">(Dec 18 2020 at 16:28)</a>:</h4>
<p>If you have any issues, please open an issue and I will take a look.</p>



<a name="220393848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220393848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220393848">(Dec 18 2020 at 16:28)</a>:</h4>
<p>Also wont future projects like std::simd have issues since they directly link to llvm functions?</p>



<a name="220394012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220394012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220394012">(Dec 18 2020 at 16:29)</a>:</h4>
<p>The goal for <code>std::simd</code> is precisely to not directly link to llvm intrinsics but instead to use the backend and target independent <code>extern "platform-intrinsic"</code>.</p>



<a name="220394075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220394075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220394075">(Dec 18 2020 at 16:29)</a>:</h4>
<p>Ah ok, i must have remembered it wrong then <span aria-label="big smile" class="emoji emoji-1f604" role="img" title="big smile">:big_smile:</span></p>



<a name="220417938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220417938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220417938">(Dec 18 2020 at 19:31)</a>:</h4>
<p><span class="user-mention silent" data-user-id="276242">Riccardo D'Ambrosio</span> <a href="#narrow/stream/131828-t-compiler/topic/question.20about.20perf/near/220390606">said</a>:</p>
<blockquote>
<p>how do you decide if the return type is correct if you havent type checked bar yet?</p>
</blockquote>
<p>I'll emphasize that being able to check other things against the signature without looking at the body is essentially <em>why</em> rust requires that the signature have all the types on it.  (It <em>could</em> do more inference, but that's worse for compiler perf, for error messages, for human readability, and for change-the-code debugging.)</p>



<a name="220418126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220418126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220418126">(Dec 18 2020 at 19:32)</a>:</h4>
<p><span class="user-mention silent" data-user-id="276242">Riccardo D'Ambrosio</span> <a href="#narrow/stream/131828-t-compiler/topic/question.20about.20perf/near/220394075">said</a>:</p>
<blockquote>
<p>Ah ok, i must have remembered it wrong then <span aria-label="big smile" class="emoji emoji-1f604" role="img" title="big smile">:big_smile:</span></p>
</blockquote>
<p>You might have noticed that the implementation still calls them as <code>llvm::simd_add</code>, but the actual declarations of those have moved off using <code>link_llvm_intrinsics</code>.</p>



<a name="220424506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220424506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220424506">(Dec 18 2020 at 20:29)</a>:</h4>
<p>To elaborate on dependencies between functions during type checking:</p>



<a name="220424589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220424589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220424589">(Dec 18 2020 at 20:30)</a>:</h4>
<p>The parallel query system is set up such that a query can block if it depends on the result of another in-progress query</p>



<a name="220424644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220424644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220424644">(Dec 18 2020 at 20:30)</a>:</h4>
<p>If you have two completely independent functions, then a parallel build of rustc should be able to type-check them in parallel</p>



<a name="220424669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220424669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220424669">(Dec 18 2020 at 20:30)</a>:</h4>
<p>If one depends on the other in some way, then you'll get less parallelism</p>



<a name="220425729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220425729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220425729">(Dec 18 2020 at 20:42)</a>:</h4>
<p>Ah ok, so you just run queries in parallel then stuff blocks if it needs to?</p>



<a name="220425768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220425768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220425768">(Dec 18 2020 at 20:42)</a>:</h4>
<p>Thats pretty smart, is the issue about enabling that by default?</p>



<a name="220426079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426079">(Dec 18 2020 at 20:46)</a>:</h4>
<p>well the issue is about running in parallel</p>



<a name="220426105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426105">(Dec 18 2020 at 20:46)</a>:</h4>
<p>currently everything still runs on-demand</p>



<a name="220426193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426193">(Dec 18 2020 at 20:47)</a>:</h4>
<p>Is it because parallel execution has <span aria-label="bug" class="emoji emoji-1f41b" role="img" title="bug">:bug:</span> ?</p>



<a name="220426273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426273">(Dec 18 2020 at 20:48)</a>:</h4>
<p>well, more that the perf situation is complicated</p>



<a name="220426278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426278">(Dec 18 2020 at 20:48)</a>:</h4>
<p>It has minor bugs and severely impacts performance when only running with one thread, from what I understand</p>



<a name="220426279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426279">(Dec 18 2020 at 20:48)</a>:</h4>
<p>I recommend reading the PR, it's more up to date</p>



<a name="220426297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426297">(Dec 18 2020 at 20:48)</a>:</h4>
<p>oh interesting, how come it butchers performance with one thread?</p>



<a name="220426303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426303">(Dec 18 2020 at 20:48)</a>:</h4>
<p>Ah ok, where is it?</p>



<a name="220426342"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426342" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426342">(Dec 18 2020 at 20:49)</a>:</h4>
<p>It replaces a lot of simple data structures with full-blown locks and mutexes</p>



<a name="220426349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426349">(Dec 18 2020 at 20:49)</a>:</h4>
<p>Oh no</p>



<a name="220426358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426358">(Dec 18 2020 at 20:49)</a>:</h4>
<p>that makes sense</p>



<a name="220426541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426541">(Dec 18 2020 at 20:51)</a>:</h4>
<p>Would it be possible to dynamically switch between the query system used based on the threads available? or is that too difficult/incurs too much size overhead?</p>



<a name="220426568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426568">(Dec 18 2020 at 20:51)</a>:</h4>
<p>hmm, unsure</p>



<a name="220426577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426577">(Dec 18 2020 at 20:51)</a>:</h4>
<p>the query system already takes like 10 minutes to compile <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="220426585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426585">(Dec 18 2020 at 20:51)</a>:</h4>
<p>I'd hate to compile it twice</p>



<a name="220426593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426593">(Dec 18 2020 at 20:51)</a>:</h4>
<p>I think before we go down that route we need to be sure that the overhead absolutely can't be reduced further</p>



<a name="220426735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426735">(Dec 18 2020 at 20:53)</a>:</h4>
<p>Well i feel like a higher compile time for rustc is definitely worth it if it means a significant-ish compilation time decrease</p>



<a name="220426740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426740">(Dec 18 2020 at 20:53)</a>:</h4>
<p>Hmm, maybe <a href="https://github.com/salsa-rs/salsa">salsa</a> is the right place to experiment with this? Though it already allows some parallelism, so not sure how relevant this is.</p>



<a name="220426757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426757">(Dec 18 2020 at 20:53)</a>:</h4>
<p>Even if my cpu will hate me for it</p>



<a name="220426783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426783">(Dec 18 2020 at 20:53)</a>:</h4>
<p><span class="user-mention silent" data-user-id="276242">Riccardo D'Ambrosio</span> <a href="#narrow/stream/131828-t-compiler/topic/question.20about.20perf/near/220426735">said</a>:</p>
<blockquote>
<p>Well i feel like a higher compile time for rustc is definitely worth it if it means a significant-ish compilation time decrease</p>
</blockquote>
<p>compile times are already like half an hour :/</p>



<a name="220426806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426806">(Dec 18 2020 at 20:53)</a>:</h4>
<p>I really don't think this is worth it unless there's no other way</p>



<a name="220426816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426816">(Dec 18 2020 at 20:53)</a>:</h4>
<p><em>cries in 50 minute stage 1 compile times</em></p>



<a name="220426824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426824">(Dec 18 2020 at 20:54)</a>:</h4>
<p>this is also a lot of contributor time to get it to work somehow</p>



<a name="220426867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426867">(Dec 18 2020 at 20:54)</a>:</h4>
<p>Ah, rust-analyzer also can do type checking in parallel (and scales <em>very</em> well with the number of cores), so looking at that setup might be helpful</p>



<a name="220426906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426906">(Dec 18 2020 at 20:54)</a>:</h4>
<p>wouldnt you be looking at chalk since its the engine behind it? or does RA itself do it somehow?</p>



<a name="220426932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426932">(Dec 18 2020 at 20:54)</a>:</h4>
<p>Ive noticed RA is lightning fast when you change something and its pretty cool</p>



<a name="220426958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426958">(Dec 18 2020 at 20:55)</a>:</h4>
<p>chalk only does trait solving</p>



<a name="220426987"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426987" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426987">(Dec 18 2020 at 20:55)</a>:</h4>
<p>The entire type inference engine is (re-)implemented in rust-analyzer itself</p>



<a name="220426994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426994">(Dec 18 2020 at 20:55)</a>:</h4>
<p>So does RA do the bulk of the type checking work?</p>



<a name="220426995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220426995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220426995">(Dec 18 2020 at 20:55)</a>:</h4>
<p>Oh wow</p>



<a name="220427006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427006">(Dec 18 2020 at 20:55)</a>:</h4>
<p>And I don't think chalk is parallel by itself</p>



<a name="220427067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427067">(Dec 18 2020 at 20:56)</a>:</h4>
<p>But we'll run multiple chalk queries in parallel if you tell rust-analyzer to typecheck in parallel</p>



<a name="220427085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427085">(Dec 18 2020 at 20:56)</a>:</h4>
<p>Isnt the goal to eventually merge the two systems and just have a really fast type checker RA can use?</p>



<a name="220427087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427087">(Dec 18 2020 at 20:56)</a>:</h4>
<p>Unfortunately it doesn't do this during normal usage</p>



<a name="220427106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427106">(Dec 18 2020 at 20:56)</a>:</h4>
<p>Yeah, to some extent</p>



<a name="220427121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427121">(Dec 18 2020 at 20:56)</a>:</h4>
<p>Integrating chalk into rustc is a big step towards that goal</p>



<a name="220427144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427144">(Dec 18 2020 at 20:57)</a>:</h4>
<p>And there's also work on the way to making a shared library for representing Rust types</p>



<a name="220427165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427165">(Dec 18 2020 at 20:57)</a>:</h4>
<p>Because to me it seems like RA reimplements some really big parts of rustc, to my knowledge it reimplements parsing, macro expansion, type checking, and type inference, right?</p>



<a name="220427166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427166">(Dec 18 2020 at 20:57)</a>:</h4>
<p>Which would be used by chalk, rustc and rust-analyzer</p>



<a name="220427189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427189">(Dec 18 2020 at 20:57)</a>:</h4>
<p>yup</p>



<a name="220427317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427317">(Dec 18 2020 at 20:58)</a>:</h4>
<p>That's interesting, the next few years will be interesting to see, itll be interesting how RA and rustc evolve since they do a lot of the same things in different implementations</p>



<a name="220427318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427318">(Dec 18 2020 at 20:58)</a>:</h4>
<p>And also name resolution</p>



<a name="220427480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427480">(Dec 18 2020 at 21:00)</a>:</h4>
<p>so thats why RA is like 100kloc+ <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="220427515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427515">(Dec 18 2020 at 21:00)</a>:</h4>
<p>oh how is WG-parselib coming btw?</p>



<a name="220427528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427528">(Dec 18 2020 at 21:00)</a>:</h4>
<p>I haven't seen any refactors by <span class="user-mention" data-user-id="133169">@matklad</span> in a while :/</p>



<a name="220427598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427598">(Dec 18 2020 at 21:01)</a>:</h4>
<p>Not aware of any progress there at the moment, I'm focusing on rust-analyzer itself</p>



<a name="220427617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427617">(Dec 18 2020 at 21:01)</a>:</h4>
<p>From what i know it would be an absolute ton of work because they use way different concepts for the tree</p>



<a name="220427719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427719">(Dec 18 2020 at 21:02)</a>:</h4>
<p>RA uses rowan which is amazing for IDEs and static analysis but rustc uses a traditional struct-based AST. I dont see how you could combine that without a lot of rework, right?</p>



<a name="220427896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427896">(Dec 18 2020 at 21:03)</a>:</h4>
<p>ra's parser is event-driven, you can use it without rowan</p>



<a name="220427949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427949">(Dec 18 2020 at 21:04)</a>:</h4>
<p>in fact someone made rustc use r-a's parser once</p>



<a name="220427963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427963">(Dec 18 2020 at 21:04)</a>:</h4>
<p>and it worked (kinda)</p>



<a name="220427979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427979">(Dec 18 2020 at 21:04)</a>:</h4>
<p>Yeah i implemented a derivative of it for my project which parses js and ts, but it still seems difficult to convert</p>



<a name="220427992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220427992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220427992">(Dec 18 2020 at 21:04)</a>:</h4>
<p>though that might have used rowan as an intermediate IR, don't remember</p>



<a name="220428058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220428058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220428058">(Dec 18 2020 at 21:05)</a>:</h4>
<p>Because from the events you just receive the start of nodes and the tokens, youd have to manually convert the tokens received to info in the ast structs, also not sure how painful stuff like forward parents would be</p>



<a name="220428331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220428331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220428331">(Dec 18 2020 at 21:08)</a>:</h4>
<p>Not to mention in struct based ASTs it's difficult to convert rowan's tree representation because if a field expects something like a block expression then you can't just give it nothing if the rowan node doesnt include it, but the RA tree doesnt care because everything is optional</p>



<a name="220428423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20perf/near/220428423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20perf.html#220428423">(Dec 18 2020 at 21:09)</a>:</h4>
<p>It seems doable but painful to implement, maybe matklad has some mad scientist trick up his sleeve to do it <span aria-label="stuck out tongue" class="emoji emoji-1f61b" role="img" title="stuck out tongue">:stuck_out_tongue:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>